<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../../../assert/css/font.css" th:href="@{/assert/css/font.css}"/>
    <link rel="stylesheet" href="../../../assert/css/bootstrap.min.css" th:href="@{/assert/css/bootstrap.min.css}"/>
    <link rel="stylesheet" href="../../../assert/css/plugin/chosen/chosen.css"
          th:href="@{/assert/css/plugin/chosen/chosen.css}"/>
    <link rel="stylesheet" href="../../../assert/css/bootstrap-table.css" th:href="@{/assert/css/bootstrap-table.css}"/>
    <link rel="stylesheet" href="../../../assert/js/plugin/bootstrap-table/bootstrap-table-page-jump-to.css" th:href="@{/assert/js/plugin/bootstrap-table/bootstrap-table-page-jump-to.css}"/>
    <link rel="stylesheet" href="../../../assert/css/bootstrap-select.min.css"
          th:href="@{/assert/css/bootstrap-select.min.css}"/>
    <link href="../../../assert/css/animate.min.css" rel="stylesheet" th:href="@{/assert/css/animate.min.css}">
    <link href="../../../assert/css/plugin/toastr/toastr.min.css" rel="stylesheet"
          th:href="@{/assert/css/plugin/toastr/toastr.min.css}">
    <link href="../../../assert/css/plugin/jsTree/style.min.css" rel="stylesheet"
          th:href="@{/assert/css/plugin/jsTree/style.min.css}">
    <link href="../../../assert/css/loaders.css" rel="stylesheet"
          th:href="@{/assert/css/loaders.css}">
    <link rel="stylesheet" href="../../../assert/css/jquery-ui.css" th:href="@{/assert/css/jquery-ui.css}"/>
    <link href="../../../assert/css/plugin/jsTree/themes/default/style.css" rel="stylesheet"
          th:href="@{/assert/css/plugin/jsTree/themes/default/style.css}">
    <link rel="stylesheet" href="../../../assert/css/index.css" th:href="@{/assert/css/index.css(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"/>
    <style>
        .search_group label.control-label{
            width:105px;
        }
        #jstreeTag {
            max-height: 544px;
        }
        .tagSModel li {
            float: left;
            padding: 3px 5px;
            background: #29cde445;
            margin-right: 10px;
            margin-top: 10px;
        }
        #tagUser_chosen{
            min-width:150px;
            width:auto !important;
        }
    </style>
</head>
<body>
<!--添加业务分类/场景模态框-->
<div class="modal fade" id="workModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog" style="width: 1000px;">
        <div class="modal-content">
            <div>
                <div class="modal-header">
                    <button type="button" class="close closeAudioModel" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">选择业务分类/场景</h4>
                </div>
                <div class="modal-body">
                    <div class="selectModel" style="height:570px !important;">
                        <div class="menu_left">
                            <div class="search_box">
                                <input type="text" autocomplete="off"><span class="fa fa-search fa_btn"
                                                                            id="searchMenuWork"></span>
                            </div>
                            <div id="jstree" class="scrollbar" style="height:520px;">

                            </div>
                        </div>
                        <div class="model_right" style="width:480px;height: 100%;">
                            <!--                            <div class="search_box">-->
                            <!--                                <input type="text" autocomplete="off" placeholder="业务分类名称" style="width: 450px;" id="tagTreeName"><span-->
                            <!--                                    class="fa fa-search fa_btn" id="searchworkName"></span>-->
                            <!--                            </div>-->
                            <table id="workTableWin"></table>
                        </div>
                        <div class="model_right" style="width: 270px;height: 546px;">
                            <div class="tagSModel" id="workSModel">
                                <div>已选业务分类/场景：</div>
                                <ul style="overflow: auto;height: 556px;">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="saveWork">保存</button>
                    <button type="button" class="btn btn-white closeAudioModel" data-dismiss="modal" id="closeWork">关闭</button>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="tools_bar">
            <div class="pull-left">
                <a href="#" class="btn btn-default active" id="btnSearch" title="隐藏查询条"><i class="fa fa-filter"></i> 隐藏</a>
                <a href="#" class="btn btn-default active" id="refresh"><i class="fa fa-refresh"></i> 刷新</a>
            </div>
        </div>
        <div class="search on">
            <div class="search_group">
                <label class="control-label">省份：</label>
                <div class="control-inline">
                    <select type="text" id="callerloc"  class="form-control search_input selectpicker" title="全部" data-code="pro"></select>
                </div>
            </div>
            <div class="search_group hidden">
                <label class="control-label">任务类型：</label>
                <div class="control-inline">
                    <select type="text" id="taskType" value="" class="form-control search_input selectpicker" title="全部"></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">呼叫类型：</label>
                <div class="control-inline">
                    <select type="text" id="callDirection" value="" class="form-control search_input selectpicker" title="全部"></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">录音流水号：</label>
                <div class="control-inline">
                    <input type="text" id="serialNumber" class="form-control search_input" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">坐席班组：</label>
                <div class="control-inline">
                    <select type="text" id="seatGroup" value="" class="form-control search_input selectpicker" title="全部"></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">坐席工号：</label>
                <div class="control-inline">
                    <input type="text" id="seatId" class="form-control search_input" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">坐席姓名：</label>
                <div class="control-inline">
                    <input type="text" id="seatName" value="" class="form-control search_input" autocomplete="off">
                </div>
            </div>

            <div class="search_group">
                <label class="control-label">客户号码：</label>
                <div class="control-inline">
                    <input type="text" id="customerNumber" class="form-control search_input" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">受理号码：</label>
                <div class="control-inline">
                    <input type="text" id="proPhoneNum" class="form-control search_input" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">挂机方：</label>
                <div class="control-inline">
                    <select type="text" id="onHook"  class="form-control search_input selectpicker" title="全部" multiple></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">是否重复来电：</label>
                <div class="control-inline">
                    <select type="text" id="reCallFlag" value="" class="form-control search_input selectpicker" title="全部"></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">满意度：</label>
                <div class="control-inline">
                    <select type="text" id="agree" value="" class="form-control search_input selectpicker" title="全部" multiple></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">客户归属地：</label>
                <div class="control-inline">
                    <select type="text" id="customerloc" value="" class="form-control search_input selectpicker" title="全部" multiple></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">客户星级：</label>
                <div class="control-inline">
                    <select type="text" id="customerLevels" value="" class="form-control search_input selectpicker" title="全部" multiple></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">重要客户：</label>
                <div class="control-inline">
                    <select type="text" id="importantCustomers" value="" class="form-control search_input selectpicker" title="全部"></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">通话时间：</label>
                <div class="control-inline">
                    <input placeholder="开始日期" class="form-control layer-date search_input" id="start" autocomplete="off"> -
                    <input placeholder="结束日期" class="form-control layer-date search_input" id="end" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">通话时长：</label>
                <div class="control-inline">
                    <input type="text" style=" width: 80px;" id="holdDurationMin" autocomplete="off"> 秒 - <input type="text"
                                                                                              id="holdDurationMax"
                                                                                              style=" width: 80px;" autocomplete="off"> 秒
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">语音入库时间：</label>
                <div class="control-inline">
                    <input placeholder="开始日期" class="form-control layer-date search_input" id="start1" autocomplete="off"> -
                    <input placeholder="结束日期" class="form-control layer-date search_input" id="end1" autocomplete="off">
                </div>
            </div>
<!--            <div class="search_group">-->
<!--                <label class="control-label">标签属性：</label>-->
<!--                <div class="control-inline">-->
<!--                    <select type="text" id="tagProperty" value="" class="form-control search_input selectpicker" title="全部"></select>-->
<!--                </div>-->
<!--            </div>-->
            <div class="search_group">
                <label class="control-label">话务小结：</label>
                <div class="control-inline">
                    <input type="text" id="tagTrafficSearch0" value="" class="form-control search_input tagName" autocomplete="off"  data-type="0">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">系统标签：</label>
                <div class="control-inline">
                    <input type="text" id="tagTrafficSearch1" value="" class="form-control search_input tagName" autocomplete="off" data-type="1">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">打标方：</label>
                <div class="control-inline">
                    <select type="text" id="tagUser" value="" class="form-control search_input selectpicker" title="全部" multiple></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">标签识别：</label>
                <div class="control-inline">
                    <select type="text" id="tagResult" class="form-control search_input selectpicker" title="全部" multiple></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">文本分析：</label>
                <div class="control-inline">
                    <select type="text" id="textResult"  class="form-control search_input  selectpicker" title="全部" multiple></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">业务分类/场景：</label>
                <div class="control-inline">
                    <input type="text" id="workNameNew" value="" class="form-control search_input" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <button id="search" class="btn  btn-primary">查询</button>
                <button id="reset" class="btn  btn-default">重置</button>
                <button id="export" class="btn  btn-default">导出</button>
            </div>
        </div>
        <table id="myTable"></table>
    </div>
</div>
<form action="" id="exportForm" class="hidden" method="post">
    <input type="text" id="provinceCodeE" name="provinceCode">
    <input type="text" id="callDirectionE" name="callDirection">
    <input type="text" id="serialNumberE" name="serialNumber">
    <input type="text" id="onHookE" name="onHook">
    <input type="text" id="seatGroupE" name="seatGroup">
    <input type="text" id="seatIdE" name="seatId">
    <input type="text" id="seatNameE" name="seatName">
    <input type="text" id="customerNumberE" name="customerNumber">
    <input type="text" id="proPhoneNumE" name="proPhoneNum">
    <input type="text" id="callStartTimeE" name="callStartTime">
    <input type="text" id="callEndTimeE" name="callEndTime">
    <input type="text" id="inputTimeBeginE" name="inputTimeBegin">
    <input type="text" id="inputTimeEndE" name="inputTimeEnd">
    <input type="text" id="holdDurationMinE" name="holdDurationMin">
    <input type="text" id="holdDurationMaxE" name="holdDurationMax">
    <input type="text" id="reCallFlagE" name="reCallFlag">
    <input type="text" id="satisfactionE" name="satisfaction">
    <input type="text" id="sysTagIdsE" name="sysTagIds">
    <input type="text" id="sysOperatorE" name="sysOperator">
    <input type="text" id="telTagIdsE" name="telTagIds">
    <input type="text" id="telOperatorE" name="telOperator">
    <input type="text" id="sysTagFlagE" name="sysTagFlag">
    <input type="text" id="appealFlagE" name="appealFlag">
    <input type="text" id="tagUseE" name="tagUse">
    <input type="text" id="customerlocE" name="customerloc">
    <input type="text" id="customerlevelE" name="customerLevel">
    <input type="text" id="customerSignE" name="customerSign">
    <input type="text" id="sceneE" name="scenes">
    <input type="text" id="methodTypeE" name="methodType" value="search">
</form>

<div class="hidden" id="tagType" th:text="${tagType}"></div><!--打标方-->
<div class="hidden" id="tagPro" th:text="${tagPro}"></div>
<div class="hidden" id="tagCustomerloc" th:text="${tagCustomerloc}"></div>
<div class="hidden" id="tagStartTime" th:text="${tagStartTime}"></div>
<div class="hidden" id="tagEndTime" th:text="${tagEndTime}"></div>
<div class="hidden" id="sysTagIds" th:text="${sysTagIds}"></div>
<div class="hidden" id="sysTagNames" th:text="${sysTagNames}"></div>
<div class="hidden" id="sysOperator" th:text="${sysOperator}"></div>
<div class="hidden" id="telTagIds" th:text="${telTagIds}"></div>
<div class="hidden" id="telTagNames" th:text="${telTagNames}"></div>
<div class="hidden" id="telOperator" th:text="${telOperator}"></div>
<div class="hidden" id="reCallFlagL" th:text="${reCallFlag}"></div>
<div class="hidden" id="satisfactionL" th:text="${satisfaction}"></div>
<div class="hidden" id="customerLevelL" th:text="${customerLevels}"></div>
<div class="hidden" id="tagSceneL" th:text="${tagSence}"></div>
<a id="basePath" th:href="@{/}"></a>
<input type="hidden" id="tagTreeId" value="" class="form-control search_input">
<input type="hidden" id="areaTreeId" value="" class="form-control search_input">
<input type="hidden" id="tagTreeType" value="" class="form-control search_input">
<input type="hidden" id="tagProperty" value="" class="form-control search_input">
<input type="hidden" id="workTreeId" value="" class="form-control search_input">
<input type="hidden" id="workAreaId" value="" class="form-control search_input">
<script src="../../../assert/js/jquery.js" th:src="@{/assert/js/jquery.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/bootstrap.min.js" th:src="@{/assert/js/bootstrap.min.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/plugin/bootstrap-table/bootstrap-table.min.js"
        th:src="@{/assert/js/plugin/bootstrap-table/bootstrap-table.min.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/plugin/bootstrap-table/bootstrap-table-mobile.min.js"
        th:src="@{/assert/js/plugin/bootstrap-table/bootstrap-table-mobile.min.js}"></script>
<script src="../../../assert/js/plugin/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"
        th:src="@{/assert/js/plugin/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<script src="../../../assert/js/plugin/bootstrap-table/bootstrap-table-page-jump-to.js"
        th:src="@{/assert/js/plugin/bootstrap-table/bootstrap-table-page-jump-to.js}"></script>
<script src="../../../assert/js/bootstrap-select.js" th:src="@{/assert/js/bootstrap-select.js}"></script>
<script src="../../../assert/js/plugin/toastr/toastr.min.js"
        th:src="@{/assert/js/plugin/toastr/toastr.min.js}"></script>
<script src="../../../assert/js/base.js" th:src="@{/assert/js/base.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/jquery-ui.min.js" th:src="@{/assert/js/jquery-ui.min.js}"></script>
<script src="../../../assert/js/plugin/layer/laydate/laydate.js"
        th:src="@{/assert/js/plugin/layer/laydate/laydate.js}"></script>
<script src="../../../assert/js/changeTime.js" th:src="@{/assert/js/changeTime.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/plugin/jsTree/jstree.min.js"
        th:src="@{/assert/js/plugin/jsTree/jstree.min.js}"></script>
<script src="../../../assert/js/plugin/chosen/chosen.jquery.js"
        th:src="@{/assert/js/plugin/chosen/chosen.jquery.js}"></script>
<script src="../../../assert/js/contabs.min.js" th:src="@{/assert/js/contabs.min.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/common.js" th:src="@{/assert/js/common.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/taskCommon.js" th:src="@{/assert/js/taskCommon.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>

<script>

    //项目名称
    var basePath = $("#basePath").attr("href");
    var TableInit = function () {
        var oTableInit = new Object();
        var url = basePath + "/rest/audio-search/get-data-by-mes";
        var height = ($(window).height() -$(".tools_bar").height()-9-$(".search").height()-40);
        //初始化Table
        oTableInit.Init = function () {
            $('#myTable').bootstrapTable({
                url: url,         //请求后台的URL（*）
                method: 'post',                      //请求方式（*）
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                sortName: "customerloc", //排序方式
                pagination: true,                   //是否显示分页（*）
                showJumpto:true,
                height:height,
                queryParams: oTableInit.queryParams,//传递参数（*）
                responseHandler: function (res) {
                    if (res.code != 0) {
                        toastrCog.error(res.msg, 2000);
                    }
                    tools.tableData = res.data;
                    return {
                        "total": res.count,//总页数
                        "rows": res.data   //数据
                    };
                },
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                contentType: "application/x-www-form-urlencoded",
                strictSearch: true,
                showColumns: false,                  //是否显示所有的列
                showRefresh: false,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: true,                //是否启用点击选中行
                uniqueId: "no",                     //每一行的唯一标识，一般为主键列
                showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: false,
                cellStyle: {
                    css: {"background-color": "#fff"}
                },//是否显示父子表
                onDblClickRow: function (row, elem) {
                    elem.find(".J_menuItem").click();
                },
                columns: [
//                    {
//                        checkbox: true, // 显示一个勾选框
//                        align: 'center' // 居中显示
//                    },
                    {
                        align: "center",
                        halign: "center",
                        title: '序号',//标题  可不加
                        width: 60,
                        formatter: function (value, row, index) {
                            var getOptions = $("#myTable").bootstrapTable('getOptions');
                            var pagenum = getOptions.pageNumber;
                            var pagesize = getOptions.pageSize;
                            var st = (pagenum - 1) * pagesize;
                            return (st + index + 1) + "";
                        }
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'province',
                        title: '省份',
                        sortable: true
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'callDirection',
                        title: '呼叫类型',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return  bs.changeState(value, tools.callDirectionArr);
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'serialNumber',
                        title: '录音流水号',
                        sortable: true
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'seatGroup',
                        title: '坐席班组',
                        sortable: true
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'seatId',
                        title: '坐席工号',
                        sortable: true
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'seatName',
                        title: '坐席姓名',
                        sortable: true
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'customerNum',
                        title: '客户号码',
                        sortable: true
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'proPhoneNum',
                        title: '受理号码',
                        sortable: true
                    }, {
                        align: "right",
                        halign: "center",
                        field: 'holdDuration',
                        title: '通话时长(秒)',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return '<span style="padding-right:20px;">' + value + '</span>';
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'callStartTime',
                        title: '通话开始时间',
                        sortable: true
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'callEndTime',
                        title: '通话结束时间',
                        sortable: true
                    },{
                        align: "center",
                        halign: "center",
                        field: 'inputTime',
                        title: '语音入库时间',
                        sortable: true
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'onHook',
                        title: '挂机方',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return bs.changeState(value, tools.onHookArr);
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'reCallFlag',
                        title: '是否重复来电',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return  bs.changeState(value, tools.reCallFlagArr);
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'satisfaction',
                        title: '满意度',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return bs.changeState(value, tools.agreeArr);
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'customerloc',
                        title: '客户归属地',
                        sortable: true,
                        formatter: function (value, row, index) {
                            var customerloc=bs.changeState(value, tools.customerlocArr);
                            if(!customerloc){
                                customerloc=value;
                            }
                            return customerloc;
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'customerLevel',
                        title: '客户星级',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return bs.changeState(value, tools.customerLevelArr,"1");
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'customerSign',
                        title: '重要客户',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return bs.changeState(value, tools.imCustomerArr);
                        }
                    }, {
                        field: 'Button',
                        title: '操作',
                        formatter: function (value, row, index) {
                            var workId = row.workId;
                            var proStatus = row.proStatus;
                            var seatGroup = row.seatGroup;
                            var seatId = row.seatId;
                            var customerNumber = row.customerNum;
                            var callStartTime = row.callStartTime;
                            var callEndTime = row.callEndTime;
                            var serialNumber = row.serialNumber;
                            var params = {
                                workId: workId,
                                callStartTime: callStartTime,
                                callEndTime: callEndTime,
                                seatGroup: seatGroup,
                                seatId: seatId,
                                proStatus: proStatus,
                                customerNumber: customerNumber,
                                serialNumber: serialNumber,
                                jumpType:"audio"
                            };
                            var href = basePath + "/rest/page/audioSearchDetail?" + $.param(params);
                            return [
                                '<a href="' + href + '" class="fa fa-eye  handleBtn J_menuItem" id="lookDetail" title="查看详情" data-index="' + serialNumber + '音频检索" data-txt="' + serialNumber + '-详情"></a>'
                            ].join("");
                        },
                        events: {
                            'click #lookDetail': function (e, value, row, index) {

                            }
                        }
                    }
                ],
                onLoadSuccess: function (data) {  //加载成功时执行
                    resize.me(1);
                    if (!data.total || data.total == 0) {
                        var src = basePath + "/assert/image/nodata.png";
                        $(".no-records-found").find("td").html('<img src="' + src + '" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                    }
                },
                onLoadError: function () {  //加载失败时执行
                    var src = basePath + "/assert/image/nodata.png";
                    $(".no-records-found").find("td").html('<img src="' + src + '" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                },
                formatLoadingMessage: function () {
                    return '<div class="loaded">' +
                        '<div class="loader">' +
                        '<div class="loader-inner line-scale-pulse-out">' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '<div>请稍等，数据正在加载中...</div>';
                }
            });
        };
        //得到查询的参数
        oTableInit.queryParams = function (params) {
            var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                pageNum: params.offset,   //页面大小
                pageSize: params.limit,
                sortName: this.sortName,
                sortOrder: this.sortOrder,
                provinceCode: $("#callerloc").val(),
                callDirection: $("#callDirection").val(),
                serialNumber: $.trim($("#serialNumber").val()),
                onHook: bs.filterSelectVal($("#onHook")),
                seatGroup: $("#seatGroup").val(),
                seatId: $.trim($("#seatId").val()),
                seatName: $.trim($("#seatName").val()),
                customerNumber: $.trim($("#customerNumber").val()),
                proPhoneNum: $.trim($("#proPhoneNum").val()),
                callStartTime: $("#start").val(),
                callEndTime: $("#end").val(),
                inputTimeBegin: $("#start1").val(),
                inputTimeEnd: $("#end1").val(),
                holdDurationMin: $.trim($("#holdDurationMin").val()),
                holdDurationMax: $.trim($("#holdDurationMax").val()),
                reCallFlag: $("#reCallFlag").val(),
                satisfaction: bs.filterSelectVal($("#agree")),
                preQuality: $("#taskType").val(),
                sysTagIds: $("#tagTrafficSearch1").attr('data-id'),
                sysOperator: $("#tagTrafficSearch1").attr('data-relation'),
                telTagIds: $("#tagTrafficSearch0").attr('data-id'),
                telOperator: $("#tagTrafficSearch0").attr('data-relation'),
                sysTagFlag: bs.filterSelectVal($("#tagResult")),
                appealFlag: bs.filterSelectVal($("#textResult")),
                tagUse: bs.filterSelectVal($("#tagUser")),
                customerloc: bs.filterSelectVal($("#customerloc")),
                customerLevel: bs.filterSelectVal($("#customerLevels")),
                customerSign: $("#importantCustomers").val(),
                scenes: $("#workNameNew").val()
            };
            return temp;
        };
        return oTableInit;
    };
    var resize = {
        init: function () {
            resize.me(1);
            $(window).resize(function () {
                resize.me();
            })
        },
        me: function (one) {
            var winW = $(window).width();
            var winH = $(window).height();
            if(one){
                $(".ibox").width(winW);
            }else{
                $(".ibox").width(winW-20);
            }
            $(".ibox").height(winH - 20);
            bs.autoTableHeight($('#myTable'),winH -$(".tools_bar").height()-9-$(".search").height())
        }
    };
    var tools = {
        proArr: [],//用来存储省份数据
        taskArr: [],//用来存储任务数据
        seatGroupArr: [],//用来存储坐席班组数据
        seatIdArr: [],//用来存储坐席工号数据
        seatNameArr: [],//用来存储坐席姓名数据
        callDirectionArr: [],//用来存储呼叫类型状态
        onHookArr: [],//用来存储挂机方状态
        reCallFlagArr: [],//用来存储重复来电状态
        agreeArr: [],//用来存储满意度状态
        taskTypeArr:[],//用来存储满意度状态
        resultArr:[],//用来存储标签命中结果/文本分析结果
        customerlocArr:[{"name":"全部","value":""}],//用来存储归属地
        customerlocArrAll:[],//用来存储全部省的归属地 主要用于转换表格中归属地
        customerLevelsArr:[],//用来存储客户星级
        imCustomerArr:[],//用来存储重要客户状态
        tagProArr: [
            {
                "name": "全部",
                "value": ""
            },
            {
                "name": "话务小结",
                "value": 0
            },
            {
                "name": "系统标签",
                "value": 1
            }
        ],
        modelSelectAudioArr: [],
        nowSelectAudioArr: [],
        tagUserArr:[],
        init: function () {
            tools.selectProvince();
            bs.dataTime("#start","#end");
            bs.dataTime("#start1","#end1");
            // bs.selectBootStrap($("#tagProperty"), tools.tagProArr);
            tools.getTaskType();
            tools.getRes();
            tools.getHook();
            tools.getSatStatus();
            tools.getReCallFlag();
            tools.getTagUser();
            tools.getCallDirection();
            tools.getImCustomer();
            tools.getCustomerLevel();
            tools.getCustomerloc($("#callerloc").val());
            if($("#callerloc").val()!=""){
                bs.selectBootStrap($("#customerloc"), tools.customerlocArr);
            }else{
                bs.selectBootStrap($("#customerloc"), tools.customerlocArrAll);
            }
            tools.tabSearch();
            tools.search();
            tools.enterSearch();
            tools.reset();
            tools.refresh();
            tools.export();
            if($("#tagStartTime").text()!==""){
                tools.initSearch()
            }else{
                tools.getSeatGroup(bs.getXInY(tools.proArr,"id","value",$("#callerloc").val()));
                tools.getSeatId(bs.getXInY(tools.proArr,"id","value",$("#callerloc").val()), $("#seatGroup").val());
            }
            var pro = $("#callerloc").val();
            if(pro == ''){
                pro = 'CHINA'
            }
            $("#workAreaId").val(pro);
            menuWorkNew.init(pro,$('#jstree'));//    获取业务数据
            workNew.init(pro,$('#jstree'));
            $("#callerloc").on("changed.bs.select", function (event, sel) {
                var code = $(this).val();
                var id = bs.getXInY(tools.proArr,"id","value",code);
                tools.getSeatGroup(id);
                tools.getSeatId(id, $("#seatGroup").val());
                tag.clearTag();
                tools.getCustomerloc(code);
                if($("#callerloc").val()!=""){
                    bs.selectBootStrap($("#customerloc"), tools.customerlocArr);
                }else{
                    bs.selectBootStrap($("#customerloc"), tools.customerlocArrAll);
                }
                var pro = $("#callerloc").val();
                if(pro == ''){
                    pro = 'CHINA'
                }
                $("#workAreaId").val(pro);
                $("#workNameNew").val('').attr('title','');
                menuWorkNew.init(pro,$('#jstree'));//    获取业务数据
            });
            $("#seatGroup").on("changed.bs.select", function (event, sel) {
                var id = $(this).val();
                tools.getSeatId(bs.getXInY(tools.proArr,"id","value",$("#callerloc").val()), id);
            });
            // $("#tagProperty").on("changed.bs.select", function (event, sel) {//切换标签属性 重置已经选的标签
            //     $("#tagName").val("").attr({
            //         "data-id":"",
            //         "title":""
            //     });
            //     tools.modelSelectAudioArr=[];
            // });
        },
        getTaskType: function () {
            var dataArr = bs.getStatus("work_type");
            Object.assign(tools.taskTypeArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#taskType"), tools.taskTypeArr);
        },
        getRes: function () {
            var dataArr = bs.getStatus("text_tag_res");
            Object.assign(tools.resultArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#textResult"), tools.resultArr);
            bs.selectBootStrap($("#tagResult"), tools.resultArr);
        },
        getHook: function () {
            var dataArr = bs.getStatus("audio_onhook");
            Object.assign(tools.onHookArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#onHook"), tools.onHookArr);
        },
        getSatStatus: function () {
            var dataArr = bs.getStatus("audio_satisfaction");
            Object.assign(tools.agreeArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#agree"), tools.agreeArr);
        },
        getReCallFlag:function(){
            var dataArr = bs.getStatus("recall_flag");
            Object.assign(tools.reCallFlagArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#reCallFlag"), tools.reCallFlagArr);
        },
        getTagUser:function(){
            var dataArr = bs.getStatus("tag_user");
            Object.assign(tools.tagUserArr,dataArr);//es6复制数组的方法
            tools.tagUserArr.shift();
            bs.selectBootStrap($("#tagUser"), tools.tagUserArr);
            $("#tagUser").val("").trigger("chosen:updated")
        },
        getCallDirection:function(){
            var dataArr = bs.getStatus("call_direction");
            Object.assign(tools.callDirectionArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#callDirection"), tools.callDirectionArr);
        },
        getCustomerloc:function(provinceCode){
            $.ajax({
                type: "POST",
                url: basePath + 'rest/common/getProvinceCity',
                dataType: "json",
                contentType: 'application/json',
                data: JSON.stringify({"provinceCode":provinceCode}),
                async: false,
                success: function (data) {
                    var result = data.data;
                    var arr=[{"name":"全部","value":""}];
                    if(provinceCode==""){
                        for(var key in result){
                            if(key!=="provinces"){
                                for(var key1 in result[key]){
                                    var obj={};
                                    obj.name=result[key][key1];
                                    obj.value=key1 ;
                                    arr.push(obj);
                                }
                            }
                        }
                        tools.customerlocArrAll=arr;
                    }else{
                        for(var key in result){
                            var obj={};
                            obj.name=result[key];
                            obj.value=key ;
                            arr.push(obj);
                        }
                        tools.customerlocArr=arr;
                    }
                }
            });
        },
        getCustomerLevel: function () {
            tools.customerLevelArr= bs.getStatus("audio_customer_level");
            bs.selectBootStrap($("#customerLevels"), tools.customerLevelArr);
        },
        getImCustomer: function () {
            tools.imCustomerArr= bs.getStatus("is_important_customers");
            bs.selectBootStrap($("#importantCustomers"), tools.imCustomerArr);
        },
        selectProvince: function () {
            tools.proArr =bs.getProvince();
            bs.selectBootStrap($("#callerloc"), tools.proArr);
        },
        getSeatGroup: function (id) {
            if($("#userIdentity",parent.document).text()=="0"){
                tools.seatGroupArr =bs.getMeSeatGroupData();
            }else{
                tools.seatGroupArr =bs.getSeatGroupData(id);
            }
            bs.selectBootStrap($("#seatGroup"), tools.seatGroupArr);
        },
        getSeatId: function (areaId, seatGroupId) {
            tools.seatAllArr=bs.getSeatData(areaId, seatGroupId,"");
            tools.seatIdArr=[];
            tools.seatNameArr=[];
            if($("#userIdentity",parent.document).text()=="0"){
                var arr=bs.getMeSeatData("");
                for(var i=0;i<arr.length;i++){
                    tools.seatIdArr.push(arr[i].account);
                    tools.seatNameArr.push(arr[i].realName);
                }
            }else{
                for(var i=0;i<tools.seatAllArr.length;i++){
                    tools.seatIdArr.push(tools.seatAllArr[i].account);
                    tools.seatNameArr.push(tools.seatAllArr[i].realName);
                }
            }
            $("#seatId").autocomplete({
                source: tools.seatIdArr
            });
            $("#seatName").autocomplete({
                source: tools.seatNameArr
            });
            if($("#userIdentity",parent.document).text()=="0"){
                if(tools.seatIdArr.length==1){
                    $("#seatId").val(tools.seatIdArr[0]).prop("disabled",true);
                    $("#seatName").val(tools.seatNameArr[0]).prop("disabled",true);
                }else{
                    $("#seatId").val("").prop("disabled",false);
                    $("#seatName").val("").prop("disabled",false);
                }
            }
        },
        tabSearch: function () {
            var search = $(".search");
            $("#btnSearch").on("click", function () {
                if (search.hasClass("on")) {
                    search.slideUp();
                    search.removeClass("on");
                    $("#btnSearch").html('<i class="fa fa-filter"></i> 查询').attr("title", "显示查询条");
                } else {
                    search.slideDown();
                    search.addClass("on");
                    $("#btnSearch").html('<i class="fa fa-filter"></i> 隐藏').attr("title", "隐藏查询条");
                }

            });
        },
        search: function () {
            $("#search").on("click", function () {
                var minH=$.trim($("#holdDurationMin").val());
                var maxH=$.trim($("#holdDurationMax").val());
                if(minH!=""){
                    var re =/^\d+(\.\d+)?$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
                    if (!re.test(minH)) {
                        toastrCog.error("通话时长必须是数字！",2000);
                        return
                    }

                }
                if(maxH!=""){
                    var re =/^\d+(\.\d+)?$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
                    if (!re.test(maxH)) {
                        toastrCog.error("通话时长必须是数字！",2000);
                        return
                    }

                }
                if(minH!="" && maxH!=""){
                    if(parseFloat(minH)>parseFloat(maxH)){
                        toastrCog.error("通话时长最小时长不得大于最大时长！",2000);
                        return
                    }
                }
                if(minH>1000000000 || maxH>1000000000){
                    toastrCog.error("通话时长不能大于1000000000！",2000);
                    return
                }
                tools.tableRefresh();
            })
        },
        enterSearch: function () {
            $("body").on("keyup", function (e) {
                var code = e.charCode || e.keyCode;
                if (code == 13) {
                    //此处编写用户敲回车后的代码
                    $("#search").click();
                }
            })
        },
        tableRefresh: function () {
            $("#myTable").bootstrapTable('refreshOptions', {pageNumber:1});
            $("#myTable").bootstrapTable('refresh');
        },
        reset: function () {
            $("#reset").on("click", function () {
                bs.resetSearch($(".search"));
                if($("#laydate_box").length>0){
                    bs.resetTimeElems("#start","#end","#start1","#end1");
                }
                if($("#spanId",parent.document).attr("data-procode")==""){
                    $("#callerloc").val("-1").trigger("chosen:updated");
                }
                if($("#userIdentity",parent.document).text()!="0"){
                    $("#seatId").val("").prop("disabled",false);
                    $("#seatName").val("").prop("disabled",false);
                }
                tag.clearTag();
                tools.tableRefresh();
            })
        },
        resetSelect: function ($obj) {
            $obj.val("");
            $obj.trigger("chosen:updated");
        },
        refresh: function () {
            $("#refresh").on("click", function () {
                $("#myTable").bootstrapTable('refresh');
            })
        },
        export: function () {
            $("#export").on("click", function () {
                if (tools.tableData.length == 0) {
                    toastrCog.error("没有可导出的数据哦！")
                    return;
                }
                var form = $("#exportForm");
                form.attr("action", basePath + "/rest/audio-search/export-data-mes");
                $("#provinceCodeE").val($("#callerloc").val());
                $("#callDirectionE").val($("#callDirection").val());
                $("#serialNumberE").val($("#serialNumber").val().trim());
                $("#callStartTimeE").val($("#start").val());
                $("#callEndTimeE").val($("#end").val());
                $("#inputTimeBeginE").val($("#start1").val());
                $("#inputTimeEndE").val($("#end1").val());
                $("#seatGroupE").val( $("#seatGroup").val());
                $("#seatIdE").val($("#seatId").val().trim());
                $("#seatNameE").val($("#seatName").val().trim());
                $("#onHookE").val(bs.filterSelectVal($("#onHook")));
                $("#customerNumberE").val($("#customerNumber").val().trim());
                $("#reCallFlagE").val($("#reCallFlag").val());
                $("#holdDurationMinE").val($("#holdDurationMin").val().trim());
                $("#holdDurationMaxE").val($("#holdDurationMax").val().trim());
                $("#satisfactionE").val(bs.filterSelectVal($("#agree")));
                $("#sysTagIdsE").val($("#tagTrafficSearch1").attr("data-id"));
                $("#sysOperatorE").val($("#tagTrafficSearch1").attr("data-relation"));
                $("#telTagIdsE").val($("#tagTrafficSearch0").attr("data-id"));
                $("#telOperatorE").val($("#tagTrafficSearch0").attr("data-relation"));
                $("#sysTagFlagE").val(bs.filterSelectVal($("#tagResult")));
                $("#appealFlagE").val(bs.filterSelectVal($("#textResult")));
                $("#tagUseE").val(bs.filterSelectVal($("#tagUser")));
                $("#proPhoneNumE").val($("#proPhoneNum").val().trim());
                $("#customerlocE").val(bs.filterSelectVal($("#customerloc")));
                $("#customerlevelE").val(bs.filterSelectVal($("#customerLevels")));
                $("#customerSignE").val($("#importantCustomers").val());
                $("#sceneE").val($("#workNameNew").val().trim());
                form[0].submit();
            })

        },
        initSearch:function(){
            $('#methodTypeE').val('tagCount');
            //省份
            $("#callerloc").selectpicker('val',$("#tagPro").text());
            $("#workAreaId").val($("#tagPro").text());
            //通话时间
            var startTime = $("#tagStartTime").text();
            var endTime = $("#tagEndTime").text();
            if(startTime.split(' ').length!=2){
                startTime = startTime+' 00:00:00'
            }
            if(endTime.split(' ').length!=2){
                endTime = endTime+' 23:59:59'
            }
            $("#start").val(startTime);
            $("#end").val(endTime);
            //重复来电
            $("#reCallFlag").selectpicker('val',$("#reCallFlagL").text());
            //满意度
            $("#agree").selectpicker('val',$("#satisfactionL").text());
            //客户星级
            $("#customerLevels").selectpicker('val',$("#customerLevelL").text());
            var sysTagNames= $("#sysTagNames").text() == '-'?"":$("#sysTagNames").text();
            var sysOperator = $("#sysOperator").text();
            if(sysTagNames){
                $("#tagTrafficSearch1").val(sysTagNames)
                    .attr("data-id",$("#sysTagIds").text())
                    .attr("title",sysTagNames)
                    .attr("data-relation",sysOperator);
            }
            var telTagNames= $("#telTagNames").text() == '-'?"":$("#telTagNames").text();
            var telOperator = $("#telOperator").text();
            if(telTagNames){
                $("#tagTrafficSearch0").val(telTagNames)
                    .attr("data-id",$("#telTagIds").text())
                    .attr("title",telTagNames)
                    .attr("data-relation",telOperator);
            }
            tools.getCustomerloc($("#callerloc").val());
            bs.selectBootStrap($("#customerloc"), tools.customerlocArr);
            tools.getSeatGroup(bs.getXInY(tools.proArr,"id","value",$("#callerloc").val()));
            tools.getSeatId(bs.getXInY(tools.proArr,"id","value",$("#callerloc").val()), $("#seatGroup").val());
            $("#tagUser").selectpicker('val',$("#tagType").text());
            $("#customerloc").selectpicker('val',$("#tagCustomerloc").text());
            $("#workNameNew").val($("#tagSceneL").text());
            $("#search").click();
        }
    };
    $(function () {
        resize.init();
        tools.init();
        var oTable = new TableInit();
        oTable.Init();
        tag.init($('#callerloc'),'Search','0');
    })
</script>
</body>
</html>